<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>设置点标注的文本标签</title>
    <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
    <style>
        html, body {
            height: 100%;
            width: 100%;
        }

        .amap-icon img {
            width: 25px;
            height: 34px;
        }

        .amap-marker-label{
            border: 0;
            background-color: transparent;
        }
        .info{
            position: relative;
            top: 0;
            right: 0;
            min-width: 0;
        }
        wrap{
            width: 100%;
            height: 100%;
        }
        .list{
            width: 1100px;
            height: 300px;
            background: #eee;
            overflow: hidden;
            margin: 0 auto;
        }
        button{
            width: 300px;
            height: 30px;
            display: block;
            margin-top: 30px;
        }
        #container{
            width: 1100px;
            height: 500px;
            margin: 0 auto;
        }
        .hua{
            width: 100px;
            height: 30px;
            background: #fff;
            text-align: center;
            line-height: 30px;
            font-size: 15px;
            border: 1px solid #ccc;
            box-sizing: border-box;
            position: relative;
            /* overflow: hidden; */
        }
        .hua p{
            width: 100px;
            height: 30px;
            position: absolute;
            left: -100px;
            top: 0;
            box-sizing: border-box;
            background: pink;
            color: #fff;
        }
    </style>
</head>
<body>
<div class="wrap">
    <div class="list">
        <button>上海[121.399404, 31.165461]</button>
        <button>昆山[120.95528,31.38215]</button>
        <button>郑州[113.724587,31.165461]</button>
        <button>北京[116.481989,39.91328]</button>
        <div class="hua">滑动<p class='pos'>滑动</p></div>
    </div>
    <div id="container"></div>
</div>
<script type="text/javascript"
        src="https://webapi.amap.com/maps?v=1.4.15&key=737240085bb7dd90737ebfbdfe0433f7"></script>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script type="text/javascript">
    var ip = [{lng:116.347428,lat:39.90923},{lng:116.347428,lat:39.90923},{lng:116.347428,lat:39.90923}]
    var map = new AMap.Map('container', {
        resizeEnable: true,
        center: [120.95530,31.38215],
        zoom: 13
    });

    $(()=>{
        $('.list button').each((i,item)=>{

            console.log(item)
            $(item).click(()=>{
                map.setZoomAndCenter(13,[120.95528,31.38215]); //同时设置地图层级与中心点 */
                marker.setPosition([120.95528,31.38215])
            })
        })
        // 划过变色
        $('.hua').hover(()=>{
            console.log(1)
            $('.pos').stop().animate({'left':'0'},500)
        },()=>{
            $('.pos').animate({'left':'100px'},500).animate({'left':'-100px'},0).stop()
        })
    })

    var marker = new AMap.Marker({
        position: map.getCenter(),
        icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
        offset: new AMap.Pixel(-13, -30)
    });

    marker.setMap(map);


    // function removeMark(){		//移除标注
	//     	map.remove(removeList);		//移除
	//     	// removeList = markerList;			//加入到容器中，准备下一次清除
	//     }
    // 设置鼠标划过点标记显示的文字提示
    marker.setTitle('华夏家博会');

    // 设置label标签
    // label默认蓝框白底左上角显示，样式className为：amap-marker-label
    marker.setLabel({
        offset: new AMap.Pixel(20, 20),  //设置文本标注偏移量
        content: "<div class='info'>华夏家博会</div>", //设置文本标注内容
        direction: 'right' //设置文本标注方位
    });
</script>
</body>
</html>